//
//  Header.h
//  UI27_预编译文件
//
//  Created by JR_Rafael on 16/1/20.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#ifndef Header_h
#define Header_h

#if DEBUG

#define kBackgroundColor [UIColor colorWithPatternImage:[UIImage imageNamed:@"beijing.jpg"]]

#define NSLog(FORMAT, ...) fprintf(stderr, "[%s:%d行] %s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);

#else

#define NSLog(FORMAT, ...) nil

#endif


#define iPhone6 ([UIScreen mainScreen].bounds.size.height == 667) ? YES : NO


//如果是 DEBUG 模式用测试服务器地址
#if DEBUG

#define     HttpBaseURL        @"http://www.test.com/" // 测试服务器

#else

#define     HttpBaseURL        @"http://www.baidu.com/" // 正式服务器

#endif


#define     iOS8     ([[[UIDevice currentDevice] systemVersion] floatValue] == 8.0) ? YES : NO


#define RGBA(R/*红*/, G/*绿*/, B/*蓝*/, A/*透明*/) \
[UIColor colorWithRed:R/255.f green:G/255.f blue:B/255.f alpha:A]

// 图片
#define IMAGE(A/*str*/) [UIImage imageNamed:A]
// 图片 + 防渲染
#define ORIGIMAGE(A/*str*/) [[UIImage imageNamed:A] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]

// RGB颜色
#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

#define WHITE_COLOR [UIColor whiteColor]

#define BALACK_COLOR [UIColor blackColor]

//#define  NIGHT_COLOR [UIColor colorWithRed:((float)((0x393939 & 0xFF0000) >> 16))/255.0 green:((float)((0x393939 & 0xFF00) >> 8))/255.0 blue:((float)(0x393939 & 0xFF))/255.0 alpha:1.0]
//#define NIGHT_COLOR RGBA(88, 105, 130, 1)
#define NIGHT_COLOR RGBA(22, 40, 64, 1)
//#define DAY_COLOR RGBA(159, 141, 188, 1)
#define DAY_COLOR RGBA(160, 186, 190, 1)
#define KAlpha 0.8
#define KChangeColorTime 1

// 尺寸
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#define SCREEN_HETGHT [UIScreen mainScreen].bounds.size.height

#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height

#define CELLWIDTH self.contentView.frame.size.width
#define CELLHEIGHT self.contentView.frame.size.height

// 等屏大小
#define kUIScreen [UIScreen mainScreen].bounds
// 屏宽
#define kUIScreenWidth [UIScreen mainScreen].bounds.size.width
// 屏高
#define kUIScreenHeight [UIScreen mainScreen].bounds.size.height

/// 网络图片解析方法
#define HANDLEIMAGE(A/*model数据*/) sd_setImageWithURL:[NSURL URLWithString:A] placeholderImage:[UIImage imageNamed:@"beijing.jpg"]
#define HANDLEBUTTONIMAGE(A/*model数据*/) sd_setBackgroundImageWithURL:[NSURL URLWithString:A] forState:UIControlStateNormal placeholderImage:[UIImage imageNamed:@"beijing.jpg"]

#define KImage [UIImage imageNamed:@"zhan"]

// MARK:VIEW_CENTER_X:屏中心x轴
#define VIEW_CENTER_X self.view.center.x

// MARK:VIEW_CENTER_Y:屏中心y轴
#define VIEW_CENTER_Y self.view.center.y

// MARK:HEIGHT:屏高
#define HEIGHT self.view.frame.size.height

// MARK:WIDTH:屏宽
#define WIDTH self.view.frame.size.width


// 创建正在加载图标
#define kLoading [GiFHUD setGifWithImageName:@"loading.gif"];[GiFHUD show]
// 加载成功移除加载动画
#define kLoaded [GiFHUD dismiss]

// 数据库
#define kDocumentPath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject]
#define kDataBasePath(listName) [documentPath stringByAppendingPathComponent:listName]



//LC
#define SCREENW [UIScreen mainScreen].bounds.size.width
#define SCREENH     [UIScreen mainScreen].bounds.size.height
#define PLACEHOLDERIMGV nil
#define ht [UIScreen mainScreen].bounds.size.height / 667
#define wt [UIScreen mainScreen].bounds.size.width / 375


#define ISIOS8 [[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0







//
//#define KIfNoNet(A, B) if ([[[NSUserDefaults standardUserDefaults]objectForKey:@"NET"]isEqualToString:@"NO"]) {A = [[UIImageView alloc] initWithFrame:CGRectMake(10, 64, kUIScreenWidth - 20, kUIScreenHeight - 64)];[self.view addSubview:B];[B release];B.image = [UIImage imageNamed:@"WBNoNetTipImg@2x"];[GiFHUD dismiss];}


#define DY NSLog(@"%@", strUrl)
#endif /* Header_h */
